import { Gateway, getGateway } from "@/droplet-bus/core.define";

import { copyStockNodeLinkRpcDto, getStockNodeRpcDto, putStockNodeRootRpcDto } from "@/river-stock/rpc.node";
import { StockNode } from "@/river-stock/schema.node";

import { OceanGateway } from "./core.define";
import { PutRes } from "~/rest";

export const GateRiverStockGateway: Gateway = getGateway(OceanGateway, "ocean_gate_river_stock");

export interface GateRiverStockInterfaceWithDerive<T> {
  /** 查询订单集合相关的节点信息，并按照层级返回节点（务必保证 tonOrderGroupId 和访客主账号一致）*/
  getNodeTree(dto: T & getStockNodeRpcDto): Promise<StockNode[][]>;

  /** 现进行集合校验，再创建根节点（务必保证 groupId 和访客主账号一致）*/
  putRootSync(dto: T & putStockNodeRootRpcDto): Promise<PutRes<StockNode>>;

  /** 转换（订单集合 && 库存节点）的关联（务必保证 groupId 和访客主账号一致）*/
  copyLink(dto: T & copyStockNodeLinkRpcDto): Promise<null>;
}
